<template>
  <div>
    <div class="title"></div>
    <div class="main">
      <!-- 顶部选择区 -->
      <div class="selectors">
        <!--区时间段选择-->
        <div class="selectTime">
          <div class="font">
            <label for="time" >区时间段：</label>
          </div>
          <div style="float: left">
            <select id="time" name="cars">
              <option value="volvo">天</option>
              <option value="month">月</option>
              <option value="season">季</option>
              <option value="year">年</option>
            </select>
          </div>
        </div>
        <!--日期选择-->
        <div class="selectDate">
          <div class="font">
            <label for="datepicker">日期：</label>
          </div>
          <div style="float: left">
            <input type="date" id="datepicker" name="datepicker">
          </div>
        </div>
        <!--区域选择-->
        <div class="selectArea">
          <div class="font">
            <label for="time" >区域选择：</label>
          </div>
          <div style="float: left">
            <select id="time" name="cars">
              <option value="volvo">天</option>
              <option value="month">月</option>
              <option value="season">季</option>
              <option value="year">年</option>
            </select>
          </div>
        </div>
      </div>
      <!-- 折线图主体区 -->
      <!-- 2. 为ECharts准备一个具备大小（宽高）的Dom -->
      <div id="main" class="charts"></div>
    </div>
  </div>
</template>
<script>
import Vue from 'vue';
import Plugin from 'v-fit-columns';
Vue.use(Plugin);
// 1.导入 echarts
import * as echarts from 'echarts';
export default {
  data() {
    return {
    }
  },
  created() {

  },
  // 此时页面上的元素已经被渲染完毕了
  mounted() {
    // 不要在create中渲染表格(create数据到了,模版还没有渲染)
    this.getGraphData()
  },
  methods: {
    getGraphData() {
      let hold = []
      /* 3.在 mounted 中初始化echarts实例*/
      let myChart = echarts.init(document.getElementById('main'));
      /* 4.准备数据和配置项 */
      myChart.setOption({
        /*5.展示数据*/
        tooltip: {},
        xAxis: {
          data: ['0', '(0 , 10]', '(10 , 20]', '(20 , 30]', '(30 , 40]', '(40 , 50]', '(50 , 60]', '(60 , 70]', '(70 , 80]', '(80 , 90]', '(90 , 100)', '100']
        },
        yAxis: {
          data: ['0.2' , '0.4' ,'0.6' ,'0.8' ,'1']
        },
        series: [
          {
            name: '全程网办率',
            type: 'bar',
            data: hold,
            barWidth: '20%',
            label: {
              show: true, // 显示标签
              position: 'top', // 顶部显示
              formatter: '{c}', // 显示数据值

            },
          },
        ],
      });
    }
  }
}

</script>

<style scoped lang="less">
.title {
  background-image: url("images/icon_title.png");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  height: 40px;
}
.main {
  //background-color: white;
  background-image: url("../../assets/images/icon_niaoqingbeijing_fenxi.png");
  background-size: contain;
  background-position: top;
  background-repeat: no-repeat;
  height: 800px;
}
.selectors {
  height: 50px;
  margin-left: 50%;
}
.selectTime {
  margin-top: 30px;
  display: block;
  background-color: #012d54;
  float: left;
  margin-right: 5%;
  height: 30px;
  select {
    min-width: 100px;
    height: 30px;
    display:block;
    background-color: #05274c;
    color: white;
  }
}
.selectDate {
  margin-top: 30px;
  display: block;
  background-color: #012d54;
  float: left;
  margin-right: 5%;
  height: 30px;

  input {
    min-width: 100px;
    height: 26px;
    display:block;
    background-color: #05274c;
    color: white;
  }
}
.selectArea {
  margin-top: 30px;
  background-color: #012d54;
  float: left;
  margin-right: 5%;
  height: 30px;
  select {
    min-width: 100px;
    height: 30px;
    display:block;
    background-color: #05274c;
    color: white;
  }
}
.font {
  float: left;
  margin-left: 5px;
  margin-top: 5px;
}
label {
  color: #3adae6;
  font-size: 15px;
}
.charts {
  width: 100%;
  height: 650px;
}

</style>